package 笔试.腾讯;

import java.util.*;

/**
 * @author:谢君臣
 * @Date:2021/8/22-21:16
 * @version:1.0
 * @function:
 */
public class Main03 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int i = 0; i < T; i++) {
            int n = scanner.nextInt();
            int w = scanner.nextInt();
            int[] nums = new int[n];
            for (int j = 0; j < n; j++) {
                nums[j] = scanner.nextInt();
            }
            function(w, nums);
        }
    }

    private static void function(int w, int[] nums) {
        int count = 0;
        LinkedList<Integer> arrayList1 = new LinkedList<>();
        LinkedList<Integer> arrayList2 = new LinkedList<>();
        for (int num : nums) {
            if (num % 2 == 0) arrayList1.add(num);
            else arrayList2.add(num);
        }
        arrayList1.sort(Integer::compareTo);//顺序
        arrayList2.sort(Integer::compareTo); // 顺序
        System.out.println(get(arrayList1, w) + get(arrayList2, w));
    }

    public static int get(LinkedList<Integer> arrayList, int w) {
        int count = 0;
        while (arrayList.size()>0) {
            if (arrayList.size()>1 && arrayList.get(0) + arrayList.get(arrayList.size() - 1) <= w)
                arrayList.remove(0);
            arrayList.remove(arrayList.size() - 1);
            count++;
        }
        return count;
    }
}
